package com.java1412.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author java1412
 * @since 2024-04-02 09:42:07
 */
@RestController
@RefreshScope   // 自动刷新最新的配置
public class HelloController {

    // 可以将foo属性的值注入到成员变量上
    @Value("${foo}")
    private String foo;

    @GetMapping(value = "/hi")
    public String hi() {
        return this.foo;
    }
}
